package learnonline.web.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import learnonline.dao.CourseDao;
import learnonline.dao.TeacherDao;
import learnonline.dao.impl.CourseDaoImpl;
import learnonline.dao.impl.JdbcImpl;
import learnonline.dao.impl.TeacherDaoImpl;
import learnonline.entity.Course;
import learnonline.entity.Teacher;
@WebServlet("/index")
public class IndexServlet extends HttpServlet{
	private TeacherDao teacherDao=new TeacherDaoImpl();
	private CourseDao courseDao=new CourseDaoImpl();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		List<Teacher> teachers=teacherDao.getAllTeacher();
		List<Course>  course=courseDao.getAllCourse();
		req.setAttribute("teachers", teachers);
		req.setAttribute("courses", course);
		req.getRequestDispatcher("index.jsp").forward(req, resp);
	}
}
